<?php
/**
 * Service 服务 模板
 */
namespace App\Service;

use App\ServiceInterface;

class DemoService implements ServiceInterface
{
    private $_server;

    private $_fd;

    private $_data;

    /**
     * BindService constructor.
     * @param null $server
     * @param int $fd
     * @param array $data
     */
    public function __construct($server=null,int $fd=0,array $data=[])
    {
        $this->_server = $server;
        $this->_fd     = $fd;
        $this->_data   = $data;
    }

    /**
     * 参数校验
     * @return string
     */
    public function check():string
    {
        if (!isset($this->_data['action']) || empty($this->_data['action']))
        {
            return 'action is null';
        }

        return '';
    }

    /**
     * 具体逻辑
     * @return array
     */
    public function init():array
    {
        try {


            return [0, 'success', []];
        }catch (\Exception $e){
            return [-1, $e->getMessage()];
        }
    }



}